<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="java.util.*" %>
<html>
<head>
	<title>Edit Mom</title>
	<link rel="stylesheet" type="text/css" href="resources/css/css.css">
	<script type="text/javascript" src="resources/js/jquery-1.3.2.min.js"></script>
	<script type="text/javascript">
	jQuery(document).ready(function() {
		
		$('body').keydown(function(e) {
		    if (e.keyCode == 13) {
		    	validForm();
		    }
		});
		document.getElementById("submitForm").onclick = function(){
		    validForm();
		}
	}
	);
	function validForm(){
		num = document.getElementById("num").value;
		price = document.getElementById("price").value;
		if(num != "" && price != "") document.getElementById("form").submit();
		else alert("Number or Price Can't be Null");
	}
</script>
</head>
<body>
<h1>
	Edit Mom
</h1>
<p><a href="mom">Mom List</a></p>
<c:if test="${!empty idEdited}">
  Mom has been updated!!
</c:if>
<form action="editMom" method="post" id="form">
		<table>
			<tr>
				<td>Decs
					<select name="decs"  id="decs" >
						<option value="top"<c:if test='${mom.decs eq "top"}'> selected="selected" </c:if>>top</option>
						<option value="down"<c:if test='${mom.decs eq "down"}'> selected="selected" </c:if>>down</option>
					</select>
				</td>
				<td>num<input type="text" name="num" value="${mom.num}" id="num"   /></td>
				<td>price<input type="text" name="price" value="${mom.price}"  id="price"  /></td>
				<td colspan="2"><input type="button" value="Edit!" id="submitForm" /><input type="hidden" name="id" value="${mom.id}"/></td>
			</tr>
		</table>
	</form>

</body>
</html>
